package com.jerp.ui.auth;

public class UserCredential {

	private String userId;
	private Object credential;
	private IAuthorized[] roles;

	public UserCredential() {

	}

	public UserCredential(String userId, Object credential) {
		this.userId = userId;
		this.credential = credential;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public Object getCredential() {
		return credential;
	}

	public void setRoles(IAuthorized[] roles) {
		this.roles = roles;
	}

	public void setCredential(Object credential) {
		this.credential = credential;
	}

	public boolean isAllowed(String roleId) {
		for (IAuthorized role : roles) {
			if (role.isAllowed(roleId)) {
				return true;
			}
		}
		return false;
	}

}
